import request from '@/utils/request'

// 获取文档列表
export function getDocumentList(params) {
  return request({
    url: '/api/v1/documents/',
    method: 'get',
    params
  })
}

// 获取文档详情
export function getDocumentDetail(slug) {
  return request({
    url: `/api/v1/documents/${slug}/`,
    method: 'get'
  })
}

// 增加文档浏览量
export function increaseDocumentViews(slug) {
  return request({
    url: `/api/v1/documents/${slug}/views/`,
    method: 'post'
  })
}

// 搜索文档
export function searchDocuments(params) {
  return request({
    url: '/api/v1/documents/search/',
    method: 'get',
    params
  })
}

// 获取最新文档
export function getLatestDocuments(params) {
  return request({
    url: '/api/v1/documents/latest/',
    method: 'get',
    params
  })
}

// 获取推荐文档
export function getRecommendedDocuments(params) {
  return request({
    url: '/api/v1/documents/recommended/',
    method: 'get',
    params
  })
}

// 获取热门文档
export function getPopularDocuments(params) {
  return request({
    url: '/api/v1/documents/popular/',
    method: 'get',
    params
  })
} 